package com.huatech.core.support.session;

import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;

import javax.websocket.Session;
/**
 * 
 * @author lihua_java@163.com
 *
 */
public class SimpleSessionUtil {
	private static ConcurrentHashMap<String, SimpleSession> sessions = new ConcurrentHashMap<>();
	
	public static void put(Session session){
		sessions.put(session.getId(), new SimpleSession(session));
	}
	
	public static SimpleSession get(String id){
		return sessions.get(id);
	}
	
	public static Collection<SimpleSession> values(){
		return sessions.values();
	}
	
	public static int size(){
		return sessions.size();
	}
	
	public static void remove(String id){
		sessions.remove(id);
	}
	
	public static void clear(){
		sessions.clear();
	}
}
